//
//  BookShelfViewController.m
//  NewBook
//
//  Created by dlios on 15-3-7.
//  Copyright (c) 2015年 dlios. All rights reserved.
//

#import "BookShelfViewController.h"

@interface BookShelfViewController ()

@end

@implementation BookShelfViewController

-(void)dealloc
{
    [_myTableView release];
    [super dealloc];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor lightGrayColor];
    //创建tableView,用来显示
    self.myTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 60 - 19) style:UITableViewStylePlain];
    self.myTableView.rowHeight = 183;
    //把tableView的分割线去掉
    self.myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.myTableView.delegate = self;
    self.myTableView.dataSource = self;
    [self.view addSubview:self.myTableView];
    [_myTableView release];
    

}
//返回行数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 10;
}
//设置行高
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 94;
}
//设置cell上的内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    BookShelfTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"ID"];
    if (cell == nil) {
        cell = [[BookShelfTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"ID"];
    }
    //将cell设置成点击时不变色
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    //    if (indexPath.row == 0) {
    //
    //
    //        //    UIImageView *aImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 5, 100, 150)];
    //        //    UIImage *aImage = [UIImage imageNamed:@"aizaixianjingderizi.jpeg"];
    //        //
    //        //    aImageView.image = aImage;
    //
    //        UIButton *aButton = [UIButton buttonWithType:UIButtonTypeCustom];
    //        [aButton setImage:[UIImage imageNamed:@"aizaixianjingderizi.jpeg"] forState:UIControlStateNormal];
    //        aButton.frame = CGRectMake(10, 5, 100, 150);
    //
    //        [aButton addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
    //        [cell addSubview:aButton];
    //    }
    return cell;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
